var KOC = require("koc.common.utils");

var Config = require("../../config");

var StateData = require("../statedata");
var DALFactory = require("../../lib/dal/dal-factory");
var CommonUtils = require("../../lib/common-utils");
var FileBuilder = require("../../lib/file-builder");
var Interface_QCloud = require("../../lib/interface-qcloud");

module.exports = {
    Service: function (req, res) {
        switch (req.params.type) {
            //region User.User_Info
            case "user.user-info.info":
                ajaxFactory.User.User_Info.Info(req, res);
                return;
            //endregion
            //region User.Family_Info
            case "user.family-info.list":
                ajaxFactory.User.Family_Info.List(req, res);
                return;
            //endregion
            //region User.User_Admin
            case "user.user-admin.edit":
                ajaxFactory.User.User_Admin.Edit(req, res);
                return;
            //endregion
            //region User.Page
            case "user.page.userinfo":
                ajaxFactory.User.Page.UserInfo(req, res);
                return;
            case "user.page.useranchor":
                ajaxFactory.User.Page.UserAnchor(req, res);
                return;
            case "user.page.useradmin":
                ajaxFactory.User.Page.UserAdmin(req, res);
                return;
            case "user.page.usermobile":
                ajaxFactory.User.Page.UserMobile(req, res);
                return;
            case "user.page.userbanktrade":
                ajaxFactory.User.Page.UserBankTrade(req, res);
                return;
            case "user.page.userpackage":
                ajaxFactory.User.Page.UserPackage(req, res);
                return;
            case "user.page.userpackagetrade":
                ajaxFactory.User.Page.UserPackageTrade(req, res);
                return;
            case "user.page.usertask":
                ajaxFactory.User.Page.UserTask(req, res);
                return;
            case "user.page.orderlive":
                ajaxFactory.User.Page.OrderLive(req, res);
                return;
            case "user.page.ordergift":
                ajaxFactory.User.Page.OrderGift(req, res);
                return;
            case "user.page.orderguardian":
                ajaxFactory.User.Page.OrderGuardian(req, res);
                return;
            case "user.page.orderhorn":
                ajaxFactory.User.Page.OrderHorn(req, res);
                return;
            case "user.page.ordermounts":
                ajaxFactory.User.Page.OrderMounts(req, res);
                return;
            case "user.page.ordervip":
                ajaxFactory.User.Page.OrderVIP(req, res);
                return;
            case "user.page.orderanchorintegral":
                ajaxFactory.User.Page.OrderAnchorIntegral(req, res);
                return;
            case "user.page.familyinfo":
                ajaxFactory.User.Page.FamilyInfo(req, res);
                return;
            case "user.page.familybanktrade":
                ajaxFactory.User.Page.FamilyBankTrade(req, res);
                return;
            //endregion
            //region Report.Page
            case "report.page.anchorfamilyday":
                ajaxFactory.Report.Page.AnchorFamilyDay(req, res);
                return;
            case "report.page.anchorfamilymonth":
                ajaxFactory.Report.Page.AnchorFamilyMonth(req, res);
                return;
            case "report.page.familymonth":
                ajaxFactory.Report.Page.FamilyMonth(req, res);
                return;
            case "report.page.channelday":
                ajaxFactory.Report.Page.ChannelDay(req, res);
                return;
            //endregion
            //region Log.Page
            case "log.page.userlogin":
                ajaxFactory.Log.Page.UserLogin(req, res);
                return;
            case "log.page.useroperation":
                ajaxFactory.Log.Page.UserOperation(req, res);
                return;
            case "log.page.familyoperation":
                ajaxFactory.Log.Page.FamilyOperation(req, res);
                return;
            case "log.page.adminoperation":
                ajaxFactory.Log.Page.AdminOperation(req, res);
                return;
            //endregion
        }
        res.jsonp({flag: -9999, msg: "未知的请求"});
    }
};

var ajaxFactory = {
    Base: {
        //region Logout:退出登录
        // Logout: function (req, res) {
        //     StateData.Clear(req, res);
        //     res.jsonp({flag: 0, msg: "退出完成"});
        // }
        //endregion
    },
    User: {
        //region User_Info:用户信息
        User_Info: {
            Info: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](Info)|{User}[Admin](Edit)") !== 0) {
                    res.jsonp({flag: -1, msg: "没有权限"});
                    return;
                }
                //endregion
                var _User_ID = KOC.StringUtils.ToIntPositive(req.params.User_ID);
                if (_User_ID == 0) {
                    res.jsonp({flag: -1, msg: "请填写用户ID"});
                    return;
                }
                DALFactory.User.User_Info.Info(_User_ID, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp({flag: retValue.errorCode, msg: retValue.message, data: null});
                        return;
                    }
                    if (!retValue.returnObject) {
                        res.jsonp({flag: 1, msg: "无此用户", data: null});
                        return;
                    }
                    res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
                });
            },
            Info_Phone: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](Info)|{User}[Admin](Edit)") !== 0) {
                    res.jsonp({flag: -1, msg: "没有权限"});
                    return;
                }
                //endregion
                var _Phone = req.params.Phone;
                if (!_Phone) {
                    res.jsonp({flag: -1, msg: "请填写手机号码"});
                    return;
                }
                DALFactory.User.User_Info.Info_Phone(_Phone, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp({flag: retValue.errorCode, msg: retValue.message, data: null});
                        return;
                    }
                    if (!retValue.returnObject) {
                        res.jsonp({flag: 1, msg: "无此手机号码", data: null});
                        return;
                    }
                    res.jsonp({flag: 0, msg: "", data: retValue.returnObject});
                });
            }
        },
        //endregion
        //region Family_Info:公会信息
        Family_Info: {
            List: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res) !== 0) {
                    res.jsonp({flag: -1, msg: "没有权限"});
                    return;
                }
                //endregion
                DALFactory.User.Family_Info.List({
                    Limit: KOC.StringUtils.ToInt(req.params.Limit, 20),
                    FuzzyQuery: KOC.StringUtils.ToString(req.params.FuzzyQuery),
                    Family_ID: KOC.StringUtils.ToIntPositive(req.params.Family_ID),
                    Family_Name: KOC.StringUtils.ToString(req.params.Family_Name),
                    User_ID: KOC.StringUtils.ToIntPositive(req.params.User_ID),
                    Phone: KOC.StringUtils.ToString(req.params.Phone),
                    Status: KOC.StringUtils.ToString(req.params.Status)
                }, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp({flag: retValue.errorCode, msg: retValue.message});
                        return;
                    }
                    var _DataList = retValue.returnObject;
                    retValue.returnObject = [];
                    KOC.Lodash.forEach(_DataList, function (ThisValue) {
                        ThisValue = KOC.Lodash.pick(ThisValue, [
                            "Family_ID",
                            "Family_Name",
                            "User_ID",
                            "Beans",
                            "Beans_Total",
                            "Anchor_Num",
                            "ContactName",
                            "Phone",
                            "Email",
                            "QQ",
                            "Create_Date",
                            "Create_IP",
                            "Settlement",
                            "Status"
                        ]);
                        ThisValue.id = ThisValue.Family_ID;
                        ThisValue.text = ThisValue.Family_Name;
                        ThisValue.ContactName = KOC.StringUtils.Cover(ThisValue.ContactName, "Name");
                        ThisValue.Phone = KOC.StringUtils.Cover(ThisValue.Phone, "Phone");
                        ThisValue.Email = KOC.StringUtils.Cover(ThisValue.Email, "Email");
                        ThisValue.QQ = KOC.StringUtils.Cover(ThisValue.QQ, "QQ");
                        retValue.returnObject.push(ThisValue);
                    });
                    res.jsonp({flag: 0, data: retValue.returnObject});
                });
            }
        },
        //endregion
        //region User_Admin:管理员信息
        User_Admin: {
            Edit: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Admin](Edit)") !== 0) {
                    res.jsonp({flag: -1, msg: "没有权限"});
                    return;
                }
                //endregion
                var _UserData = StateData.Value(req, res);//取得状态
                var _User_Admin = {
                    User_ID: KOC.StringUtils.ToIntPositive(req.params.User_ID),
                    RealName: KOC.StringUtils.ToString(req.params.RealName),
                    Phone: KOC.StringUtils.ToString(req.params.Phone),
                    IsMaster: KOC.StringUtils.ToIntPositive(req.params.IsMaster),
                    RightCode: KOC.StringUtils.ToString(req.params.RightCode),
                    Status: KOC.StringUtils.ToInt(req.params.Status),
                    Create_IP: KOC.StringUtils.GetClientIP(req)
                };
                var _Insert = true;
                KOC.Async.series([
                    //读取用户信息
                    function (callback) {
                        DALFactory.User.User_Info.Info(_User_Admin.User_ID, function (retValue) {
                            if (retValue.hasError) {
                                callback(retValue);
                                return;
                            }
                            if (!retValue.returnObject) {
                                retValue.hasError = true;
                                retValue.message = "无此用户";
                                callback(retValue);
                                return;
                            }
                            callback();
                        });
                    },
                    //读取管理员信息
                    function (callback) {
                        DALFactory.User.User_Admin.Info(_User_Admin.User_ID, function (retValue) {
                            if (retValue.hasError) {
                                callback(retValue);
                                return;
                            }
                            if (!retValue.returnObject) {
                                return;
                            }
                            _Insert = false;
                            callback();
                        });
                    },
                    //增加
                    function (callback) {
                        if (!_Insert) {
                            callback();
                            return;
                        }
                        DALFactory.User.User_Admin.Insert(_User_Admin, function (retValue) {
                            if (retValue.hasError) {
                                callback(retValue);
                                return;
                            }
                            callback();
                        });
                    },
                    //修改
                    function (callback) {
                        if (_Insert) {
                            callback();
                            return;
                        }
                        DALFactory.User.User_Admin.Update(null, _User_Admin, function (retValue) {
                            if (retValue.hasError) {
                                callback(retValue);
                                return;
                            }
                            if (retValue.returnObject !== 1) {
                                retValue.hasError = true;
                                retValue.message = "修改管理员信息数据出错，影响行(" + retValue.returnObject + ")";
                                callback(retValue);
                                return;
                            }
                            callback();
                        });
                    },
                    //写入操作日志
                    // function (callback) {
                    //     var _Merchant_Operation = {
                    //         Log_Type: 15,
                    //         Operate_Type: _Employee_ID <= 0 ? 1 : 2,
                    //         Order_No: _Merchant_Employee.Employee_ID,
                    //         Title: _Employee_ID <= 0 ? "增加员工" : "修改员工",
                    //         Operation: "",
                    //         Data: JSON.stringify(_Merchant_Employee),
                    //         Merchant_ID: _UserData.Merchant_ID,
                    //         Store_ID: _UserData.Store_ID,
                    //         Employee_ID: _UserData.Employee_ID,
                    //         RealName: _UserData.RealName,
                    //         Phone: _UserData.Phone,
                    //         Create_IP: KOC.StringUtils.GetClientIP(req)
                    //     };
                    //     _DALFactory.Log.Merchant_Operation.Insert(_Merchant_Operation, function (retValue) {
                    //         if (retValue.hasError) {
                    //             callback(retValue);
                    //             return;
                    //         }
                    //         callback();
                    //     });
                    // }
                ], function (retValue) {
                    if (retValue) {
                        res.jsonp({flag: retValue.errorCode, msg: retValue.message});
                        return;
                    }
                    res.jsonp({flag: 0, msg: "完成", id: _User_Admin.User_ID});
                });
            }
        },
        //endregion
        //region Page:分页
        Page: {
            UserInfo: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserInfo_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.IDCard = req.params.F_IDCard;
                reqParm.IDCard_Status = req.params.F_IDCardStatus;
                reqParm.Email = req.params.F_Email;
                reqParm.Phone = req.params.F_Phone;
                reqParm.QQ = req.params.F_QQ;
                reqParm.Sex = KOC.StringUtils.ToInt(req.params.F_Sex, -1);
                reqParm.Province = req.params.F_Province;
                reqParm.City = req.params.F_City;
                reqParm.Channel_ID = req.params.F_ChannelID;
                reqParm.Inviter_ID = KOC.StringUtils.ToIntPositive(req.params.F_InviterID);
                reqParm.SignUp_Origin = KOC.StringUtils.ToString(req.params.F_SignUpOrigin);
                reqParm.SignUp_Anchor_ID = KOC.StringUtils.ToIntPositive(req.params.F_SignUpAnchorID);
                reqParm.SignUp_Anchor_Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_SignUpAnchorFamilyID);
                reqParm.Charge_First = KOC.StringUtils.ToInt(req.params.F_ChargeFirst, -1);
                reqParm.IsVIP = KOC.StringUtils.ToInt(req.params.F_IsVIP, -1);
                reqParm.IsAnchor = KOC.StringUtils.ToInt(req.params.F_IsAnchor, -1);
                reqParm.IsFamily = KOC.StringUtils.ToInt(req.params.F_IsFamily, -1);
                reqParm.IsAdmin = KOC.StringUtils.ToInt(req.params.F_IsAdmin, -1);
                reqParm.OAuth_Phone = KOC.StringUtils.ToInt(req.params.F_OAuthPhone, -1);
                reqParm.OAuth_QQ = KOC.StringUtils.ToInt(req.params.F_OAuthQQ, -1);
                reqParm.OAuth_Weibo = KOC.StringUtils.ToInt(req.params.F_OAuthWeibo, -1);
                reqParm.OAuth_Weixin = KOC.StringUtils.ToInt(req.params.F_OAuthWeixin, -1);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "IDCard":
                        case "Email":
                        case "Phone":
                        case "QQ":
                        case "Channel_ID":
                        case "Inviter_ID":
                        case "SignUp_Anchor_ID":
                        case "SignUp_Anchor_Family_ID":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "IDCard_Status":
                    case "IDCard_Date":
                    case "Channel_ID":
                    case "Inviter_ID":
                    case "SignUp_Anchor_ID":
                    case "SignUp_Anchor_Family_ID":
                    case "EXP":
                    case "VIP":
                    case "VIP_Expire":
                    case "Coin":
                    case "Beans":
                    case "Pomelo":
                    case "Fans":
                    case "Attention":
                    case "IsAnchor":
                    case "IsFamily":
                    case "IsAdmin":
                    case "Charge_First":
                    case "Charge_First_Date":
                    case "Charge_First_Award":
                    case "Charge_Last_Date":
                    case "Login_Count":
                    case "Login_This_Date":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`User_ID`";
                        break;
                }
                DALFactory.User.Page.UserInfo(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserAnchor: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Anchor](List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserAnchor_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.IDCard = req.params.F_IDCard;
                reqParm.IDCard_Status = req.params.F_IDCardStatus;
                reqParm.Email = req.params.F_Email;
                reqParm.Phone = req.params.F_Phone;
                reqParm.QQ = req.params.F_QQ;
                reqParm.Sex = KOC.StringUtils.ToInt(req.params.F_Sex, -1);
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Approve_Admin_ID = KOC.StringUtils.ToIntPositive(req.params.F_ApproveAdminID);
                reqParm.Duty_Admin_ID = KOC.StringUtils.ToIntPositive(req.params.F_DutyAdminID);
                reqParm.Cover_Admin_ID = KOC.StringUtils.ToIntPositive(req.params.F_CoverAdminID);
                reqParm.Tags = req.params.F_Tags;
                reqParm.IsFamily = KOC.StringUtils.ToInt(req.params.F_IsFamily, -1);
                reqParm.IsWeekStar = KOC.StringUtils.ToInt(req.params.F_IsWeekStar, -1);
                reqParm.IsRecommend = KOC.StringUtils.ToInt(req.params.F_IsRecommend, -1);
                reqParm.Live = KOC.StringUtils.ToInt(req.params.F_Live, -1);
                reqParm.Live_IsMobile = KOC.StringUtils.ToInt(req.params.F_LiveIsMobile, -1);
                reqParm.Live_Stream_Status = KOC.StringUtils.ToInt(req.params.F_LiveStreamStatus, -1);
                reqParm.Live_Mode = KOC.StringUtils.ToInt(req.params.F_LiveMode, -1);
                reqParm.Rating = req.params.F_Rating;
                reqParm.Integral_Type = req.params.F_IntegralType;
                reqParm.Start_AnchorEXP = KOC.StringUtils.ToInt(req.params.F_StartAnchorEXP, -1);
                reqParm.End_AnchorEXP = KOC.StringUtils.ToInt(req.params.F_EndAnchorEXP, -1);
                reqParm.Start_Integral = KOC.StringUtils.ToInt(req.params.F_StartIntegral, -1);
                reqParm.End_Integral = KOC.StringUtils.ToInt(req.params.F_EndIntegral, -1);
                reqParm.ProtectDue_Date = req.params.F_ProtectDueDate;
                reqParm.DateType = req.params.F_DateType;
                reqParm.StartDate = req.params.F_StartDate;
                reqParm.EndDate = req.params.F_EndDate;
                reqParm.Status = req.params.F_Status;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "Family_ID":
                        case "NickName":
                        case "RealName":
                        case "IDCard":
                        case "Email":
                        case "Phone":
                        case "QQ":
                        case "Approve_Admin_ID":
                        case "Duty_Admin_ID":
                        case "Cover_Admin_ID":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "IDCard_Status":
                    case "IDCard_Date":
                    case "Family_ID":
                    case "Approve_Admin_ID":
                    case "Duty_Admin_ID":
                    case "Cover_Admin_ID":
                    case "Live":
                    case "Coin":
                    case "Beans":
                    case "Rating":
                    case "Tags":
                    case "Live_Mode":
                    case "Pomelo":
                    case "Pomelo_Today":
                    case "Pomelo_Week":
                    case "Pomelo_Month":
                    case "Pomelo_Year":
                    case "Anchor_EXP":
                    case "ActivityNum":
                    case "HotValue":
                    case "HotValue_Ranking":
                    case "List_Order":
                    case "Live_IsMobile":
                    case "Live_StartTime":
                    case "Live_Duration_Total":
                    case "Live_Stream_LastDate":
                    case "Live_Stream_Status":
                    case "IsWeekStar":
                    case "IsRecommend":
                    case "Score":
                    case "Score_Last":
                    case "Score_Coin":
                    case "Score_Coin_Last":
                    case "Score_SignUp":
                    case "Score_SignUp_Last":
                    case "Integral":
                    case "Integral_Month":
                    case "Integral_Month_Last":
                    case "Integral_Week":
                    case "Integral_Week_Last":
                    case "Live_FirstDate":
                    case "Integral_Date":
                    case "Approve_Date":
                    case "Cover_Date":
                    case "ProtectDue_Date":
                    case "Create_Date":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`User_ID`";
                        break;
                }
                DALFactory.User.Page.UserAnchor(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserAdmin: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Admin](List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserAdmin_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Phone = req.params.F_Phone;
                reqParm.IsMaster = KOC.StringUtils.ToInt(req.params.F_IsMaster, -1);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Phone":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "IsMaster":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`User_ID`";
                        break;
                }
                DALFactory.User.Page.UserAdmin(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserMobile: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](Mobile-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserMobile_Parm();
                reqParm.Mobile_ID = KOC.StringUtils.ToIntPositive(req.params.F_MobileID);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.Equipment_Type = KOC.StringUtils.ToString(req.params.F_EquipmentType);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Mobile_ID":
                        case "Equipment_Code":
                        case "Equipment_Name":
                        case "OS_Version":
                        case "APP_Version":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Mobile_ID":
                    case "Equipment_Name":
                    case "APP_Version":
                    case "Open_Count":
                    case "Open_Last_Date":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Open_Last_Date`";
                        break;
                }
                DALFactory.User.Page.UserMobile(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserBankTrade: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](BankTrade-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserBankTrade_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.User_NickName = req.params.F_UserNickName;
                reqParm.User_RealName = req.params.F_UserRealName;
                reqParm.User_Channel_ID = req.params.F_UserChannelID;
                reqParm.Related_User_ID = KOC.StringUtils.ToIntPositive(req.params.F_RelatedUserID);
                reqParm.Related_User_NickName = req.params.F_RelatedUserNickName;
                reqParm.Related_Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_RelatedFamilyID);
                reqParm.Related_Family_Name = req.params.F_RelatedFamilyName;
                reqParm.Trade_Order_No = req.params.F_TradeOrderNo;
                reqParm.Remark = req.params.F_Remark;
                reqParm.Trade_Currency = KOC.StringUtils.ToInt(req.params.F_TradeCurrency, -1);
                reqParm.Trade_Type = KOC.StringUtils.ToInt(req.params.F_TradeType, -1);
                reqParm.Trade_Flag = KOC.StringUtils.ToInt(req.params.F_TradeFlag);
                reqParm.Trade_Amt_MIN = KOC.StringUtils.ToInt(req.params.F_TradeAmtMIN, -1);
                reqParm.Trade_Amt_MAX = KOC.StringUtils.ToInt(req.params.F_TradeAmtMAX, -1);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Create_IP = KOC.StringUtils.ToString(req.params.F_CreateIP);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "User_Channel_ID":
                        case "Related_User_ID":
                        case "Related_User_NickName":
                        case "Related_User_RealName":
                        case "Related_Family_ID":
                        case "Related_Family_Name":
                        case "Trade_Order_No":
                        case "Remark":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Trade_ID":
                    case "User_ID":
                    case "User_Channel_ID":
                    case "Related_User_ID":
                    case "Related_Family_ID":
                    case "Trade_Currency":
                    case "Trade_Type":
                    case "Trade_Flag":
                    case "Trade_Amt":
                    case "Trade_Order_No":
                    case "Amt":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Trade_ID`";
                        break;
                }
                DALFactory.User.Page.UserBankTrade(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserPackage: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](Package-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserPackage_Parm(req, res);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.Item_Type = req.params.F_ItemType;
                reqParm.Item_ID = req.params.F_ItemID;
                reqParm.Item_Name = req.params.F_ItemName;
                reqParm.Num_MIN = KOC.StringUtils.ToInt(req.params.F_NumMIN, -1);
                reqParm.Num_MAX = KOC.StringUtils.ToInt(req.params.F_NumMAX, -1);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Item_ID":
                        case "Item_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Item_ID":
                    case "Item_Name":
                    case "Item_Type":
                    case "Num":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Num`";
                        break;
                }
                DALFactory.User.Page.UserPackage(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserPackageTrade: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](PackageTrade-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserPackageTrade_Parm(req, res);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.User_NickName = req.params.F_UserNickName;
                reqParm.User_RealName = req.params.F_UserRealName;
                reqParm.Item_Type = req.params.F_ItemType;
                reqParm.Item_ID = req.params.F_ItemID;
                reqParm.Item_Name = req.params.F_ItemName;
                reqParm.Trade_Order_No = req.params.F_TradeOrderNo;
                reqParm.Trade_Type = KOC.StringUtils.ToInt(req.params.F_TradeType, -1);
                reqParm.Trade_Flag = KOC.StringUtils.ToInt(req.params.F_TradeFlag);
                reqParm.Trade_Num_MIN = KOC.StringUtils.ToInt(req.params.F_TradeNumMIN, -1);
                reqParm.Trade_Num_MAX = KOC.StringUtils.ToInt(req.params.TradeNumMAX, -1);
                reqParm.Remark = req.params.F_Remark;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Create_IP = KOC.StringUtils.ToString(req.params.F_CreateIP);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "Item_ID":
                        case "Item_Name":
                        case "Trade_Order_No":
                        case "Remark":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Trade_ID":
                    case "User_ID":
                    case "Item_ID":
                    case "Item_Name":
                    case "Item_Type":
                    case "Trade_Type":
                    case "Trade_Flag":
                    case "Trade_Num":
                    case "Trade_Order_No":
                    case "Num":
                    case "Remark":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Trade_ID`";
                        break;
                }
                DALFactory.User.Page.UserPackageTrade(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserTask: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Base](Task-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.UserTask_Parm(req, res);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.User_NickName = req.params.F_UserNickName;
                reqParm.User_RealName = req.params.F_UserRealName;
                reqParm.Task_ID = KOC.StringUtils.ToIntPositive(req.params.F_TaskID);
                reqParm.Task_Name = req.params.F_TaskName;
                reqParm.Task_Mode = req.params.F_TaskMode;
                reqParm.Task_Date = req.params.F_TaskDate;
                reqParm.DateType = req.params.F_DateType;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = req.params.F_Status;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "Task_ID":
                        case "Task_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Receive_Date":
                    case "Task_ID":
                    case "Task_Name":
                    case "Task_Date":
                    case "Task_Mode":
                    case "Task_Progress":
                    case "Trade_Order_No":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`User_ID`";
                        break;
                }
                DALFactory.User.Page.UserTask(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderLive: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Room](Live-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderLive_Parm();
                reqParm.Family_ID = KOC.StringUtils.ToInt(req.params.F_Family);
                reqParm.IsMobile = KOC.StringUtils.ToInt(req.params.F_IsMobile, -1);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Order_No":
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Family_ID":
                    case "IsMobile":
                    case "Mode":
                    case "Coin":
                    case "Gift_Num":
                    case "Gift_Num_Anchor":
                    case "Gift_Num_User":
                    case "Gift_Count":
                    case "Gift_Count_Anchor":
                    case "Gift_Count_User":
                    case "Gift_Coin":
                    case "Gift_Coin_Anchor":
                    case "Gift_Coin_User":
                    case "Gift_Beans_Anchor":
                    case "Gift_Beans_Family":
                    case "Gift_Beans_User":
                    case "Gift_Beans_UserFamily":
                    case "Gift_Beans_Platform":
                    case "Gift_Pond_Count":
                    case "Gift_Pond_Coin":
                    case "Guardian_Count":
                    case "Guardian_Coin":
                    case "Guardian_Beans_Anchor":
                    case "Guardian_Beans_Family":
                    case "Guardian_Beans_Platform":
                    case "Horn_Count":
                    case "Horn_Coin":
                    case "Horn_Beans_Anchor":
                    case "Horn_Beans_Family":
                    case "Horn_Beans_Platform":
                    case "Pomelo":
                    case "Duration":
                    case "End_Date":
                    case "Create_Date":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderLive(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderGift: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Room](Gift-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderGift_Parm();
                reqParm.Live_Order_No = KOC.StringUtils.ToString(req.params.F_LiveOrderNo);
                reqParm.Family_ID = KOC.StringUtils.ToInt(req.params.F_Family);
                reqParm.Gift_ID = KOC.StringUtils.ToInt(req.params.F_Gift);
                reqParm.User_ID = KOC.StringUtils.ToString(req.params.F_UserID);
                reqParm.User_ID_Gift = KOC.StringUtils.ToString(req.params.F_UserIDGift);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Lucky = KOC.StringUtils.ToInt(req.params.F_Lucky, -1);
                reqParm.PurchaseMode = KOC.StringUtils.ToInt(req.params.F_PurchaseMode, -1);
                reqParm.IsTask = KOC.StringUtils.ToInt(req.params.F_IsTask, -1);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "User_NickName_Gift":
                        case "User_RealName_Gift":
                        case "Family_Name":
                        case "Gift_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Live_Order_No":
                    case "Family_ID":
                    case "Gift_ID":
                    case "Gift_Price":
                    case "Commission_Gift_Family":
                    case "Commission_Gift_Anchor":
                    case "Commission_Anchor_Family":
                    case "Lucky":
                    case "LuckyCoin":
                    case "Order_Num":
                    case "Order_Amt":
                    case "Order_Amt_Anchor":
                    case "Order_Amt_Platform":
                    case "Order_Amt_Family":
                    case "PurchaseMode":
                    case "IsTask":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderGift(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderGuardian: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Room](Guardian-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderGuardian_Parm();
                reqParm.Live_Order_No = KOC.StringUtils.ToString(req.params.F_LiveOrderNo);
                reqParm.Family_ID = KOC.StringUtils.ToInt(req.params.F_Family);
                reqParm.Guardian_ID = KOC.StringUtils.ToInt(req.params.F_Guardian);
                reqParm.User_ID = KOC.StringUtils.ToString(req.params.F_UserID);
                reqParm.User_ID_Guardian = KOC.StringUtils.ToString(req.params.F_UserIDGuardian);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "User_NickName_Guardian":
                        case "User_RealName_Guardian":
                        case "Family_Name":
                        case "Guardian_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Live_Order_No":
                    case "User_ID":
                    case "User_ID_Guardian":
                    case "Family_ID":
                    case "Guardian_ID":
                    case "Guardian_Value":
                    case "Order_Amt":
                    case "Order_Amt_Anchor":
                    case "Order_Amt_Platform":
                    case "Order_Amt_Family":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderGuardian(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderHorn: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Room](Horn-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderHorn_Parm();
                reqParm.Live_Order_No = KOC.StringUtils.ToString(req.params.F_LiveOrderNo);
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_Family);
                reqParm.Horn_Mode = KOC.StringUtils.ToString(req.params.F_HornMode);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.User_ID_Anchor = KOC.StringUtils.ToIntPositive(req.params.F_UserIDAnchor);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Order_No":
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "User_NickName_Anchor":
                        case "User_RealName_Anchor":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Live_Order_No":
                    case "User_ID":
                    case "User_ID_Anchor":
                    case "Family_ID":
                    case "Order_Amt":
                    case "Order_Amt_Anchor":
                    case "Order_Amt_Platform":
                    case "Order_Amt_Family":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderHorn(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderVIP: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Other](VIP-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderVIP_Parm();
                reqParm.VIP_ID = KOC.StringUtils.ToInt(req.params.F_VIP);
                reqParm.User_ID = KOC.StringUtils.ToString(req.params.F_UserID);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "Family_Name":
                        case "VIP_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Family_ID":
                    case "VIP_ID":
                    case "Order_Amt":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderVIP(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderMounts: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Other](Mounts-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderMounts_Parm();
                reqParm.Mounts_ID = KOC.StringUtils.ToIntPositive(req.params.F_Mounts);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Order_No":
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Order_No":
                    case "User_ID":
                    case "Mounts_ID":
                    case "Mounts_Price":
                    case "Order_Num":
                    case "Order_Amt":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderMounts(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            OrderAnchorIntegral: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Order}[Admin](AnchorIntegral-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.OrderAnchorIntegral_Parm();
                reqParm.User_ID = KOC.StringUtils.ToString(req.params.F_UserID);
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_Family);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Status = KOC.StringUtils.ToString(req.params.F_Status);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "User_NickName":
                        case "User_RealName":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Family_ID":
                    case "Order_Amt":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Order_No`";
                        break;
                }
                DALFactory.User.Page.OrderAnchorIntegral(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            FamilyInfo: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Family](List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.FamilyInfo_Parm();
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Family_Name = req.params.F_Family_Name;
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Email = req.params.F_Email;
                reqParm.Phone = req.params.F_Phone;
                reqParm.QQ = req.params.F_QQ;
                reqParm.Sex = KOC.StringUtils.ToInt(req.params.F_Sex, -1);
                reqParm.IsAnchor = KOC.StringUtils.ToInt(req.params.F_IsAnchor, -1);
                reqParm.IsAdmin = KOC.StringUtils.ToInt(req.params.F_IsAdmin, -1);
                reqParm.Account_RealName = req.params.F_AccountRealName;
                reqParm.Account_CardNo = req.params.F_AccountCardNo;
                reqParm.ContactName = req.params.F_ContactName;
                reqParm.Start_Anchor_Num = KOC.StringUtils.ToIntPositive(req.params.F_StartAnchorNum);
                reqParm.End_Anchor_Num = KOC.StringUtils.ToIntPositive(req.params.F_EndAnchorNum);
                reqParm.Family_Phone = req.params.F_FamilyPhone;
                reqParm.Family_Email = req.params.F_FamilyEmail;
                reqParm.Family_QQ = req.params.F_FamilyQQ;
                reqParm.DateType = req.params.F_DateType;
                reqParm.StartDate = req.params.F_StartDate;
                reqParm.EndDate = req.params.F_EndDate;
                reqParm.Status = req.params.F_Status;
                reqParm.Settlement = KOC.StringUtils.ToIntPositive(req.params.F_Settlement);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Family_ID":
                        case "Family_Name":
                        case "Family_Phone":
                        case "Family_Email":
                        case "Family_QQ":
                        case "ContactName":
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Email":
                        case "Phone":
                        case "QQ":
                        case "Account_RealName":
                        case "Account_CardNo":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Family_ID":
                    case "User_ID":
                    case "Family_Name":
                    case "Family_Beans":
                    case "Family_Beans_Total":
                    case "Anchor_Num":
                    case "Account_City":
                    case "Account_Province":
                    case "Account_RealName":
                    case "Settlement":
                    case "Approve_Date":
                    case "Status":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`User_ID`";
                        break;
                }
                DALFactory.User.Page.FamilyInfo(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            FamilyBankTrade: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{User}[Family](BankTrade-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.User.Page.FamilyBankTrade_Parm();
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Family_Name = req.params.F_FamilyName;
                reqParm.Related_User_ID = KOC.StringUtils.ToIntPositive(req.params.F_RelatedUserID);
                reqParm.Related_User_NickName = req.params.F_RelatedUserNickName;
                reqParm.Related_Anchor_ID = KOC.StringUtils.ToIntPositive(req.params.F_RelatedAnchorID);
                reqParm.Related_Anchor_NickName = req.params.F_RelatedAnchorNickName;
                reqParm.Related_User_RealName = req.params.F_RelatedUserRealName;
                reqParm.Trade_Order_No = req.params.F_TradeOrderNo;
                reqParm.Remark = req.params.F_Remark;
                reqParm.Trade_Type = KOC.StringUtils.ToInt(req.params.F_TradeType, -1);
                reqParm.Trade_Flag = KOC.StringUtils.ToInt(req.params.F_TradeFlag);
                reqParm.Trade_Amt_MIN = KOC.StringUtils.ToInt(req.params.F_TradeAmtMIN, -1);
                reqParm.Trade_Amt_MAX = KOC.StringUtils.ToInt(req.params.F_TradeAmtMAX, -1);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Create_IP = KOC.StringUtils.ToString(req.params.F_CreateIP);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Family_ID":
                        case "Family_Name":
                        case "Related_Anchor_ID":
                        case "Related_Anchor_NickName":
                        case "Related_Anchor_RealName":
                        case "Related_User_ID":
                        case "Related_User_NickName":
                        case "Related_User_RealName":
                        case "Trade_Order_No":
                        case "Remark":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Trade_ID":
                    case "Family_ID":
                    case "Related_Anchor_ID":
                    case "Related_User_ID":
                    case "Trade_Type":
                    case "Trade_Flag":
                    case "Trade_Amt":
                    case "Trade_Order_No":
                    case "Amt":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Trade_ID`";
                        break;
                }
                DALFactory.User.Page.FamilyBankTrade(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            }
        }
        //endregion
    },
    Report: {
        //region Page:分页
        Page: {
            AnchorFamilyDay: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Report}[Anchor](Day-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Report.Page.AnchorFamilyDay_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Family_Name = req.params.F_FamilyName;
                reqParm.Rating = req.params.F_Rating;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Group = req.params.F_Group;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Family_ID":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Rating":
                    case "Family_ID":
                    case "Beans_Anchor":
                    case "Beans_Family":
                    case "Beans_Platform":
                    case "Gift_Num":
                    case "Gift_Coin":
                    case "Guardian_Count":
                    case "Guardian_Coin":
                    case "Horn_Count":
                    case "Horn_Coin":
                    case "Live_Duration_Efftive":
                    case "Live_Day_Efftive":
                    case "PV_ChannelStrategy":
                    case "User_SignUp_Count":
                    case "User_SignUp_Rate_ChannelStrategy":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Coin":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Live_Duration` DESC";
                        break;
                    case "Live_Duration":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC";
                        break;
                    case "Profit":
                        reqModel.Sort_Col = "(`Beans_Platform` - `Gift_Pond_Coin` - `Gift_Lucky_Coin` - `Lottery_Winning_Amt`) :DIR:, `Report_Day` DESC, `Coin` DESC";
                        break;
                    case "Gift_Coin_Return":
                        reqModel.Sort_Col = "(`Gift_Pond_Coin` + `Gift_Lucky_Coin`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Coin":
                        reqModel.Sort_Col = "`Lottery_Coin` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Return":
                        reqModel.Sort_Col = "`Lottery_Winning_Amt` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Profit":
                        reqModel.Sort_Col = "(`Lottery_Coin` - `Lottery_Winning_Amt`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    default:
                        switch (reqParm.Group) {
                            case "Day":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "User":
                                reqModel.Sort_Col = "`Coin` :DIR:, `Live_Duration` DESC";
                                break;
                            case "Day-User":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Family":
                                reqModel.Sort_Col = "`Coin` :DIR:, `Live_Duration` DESC";
                                break;
                            case "Day-Family":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            default:
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                        }
                        break;
                }
                DALFactory.Report.Page.AnchorFamilyDay(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            AnchorFamilyMonth: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Report}[Anchor](Month-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Report.Page.AnchorFamilyMonth_Parm();
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.IsProtect = KOC.StringUtils.ToInt(req.params.F_IsProtect, -1);
                reqParm.IsProtectDue = KOC.StringUtils.ToInt(req.params.F_IsProtectDue, -1);
                reqParm.Rating = req.params.F_Rating;
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Family_Name = req.params.F_FamilyName;
                reqParm.IsTaskBeans = KOC.StringUtils.ToInt(req.params.F_IsTaskBeans, -1);
                reqParm.IsTaskLiveDay = KOC.StringUtils.ToInt(req.params.F_IsTaskLiveDay, -1);
                reqParm.IsTaskLiveDuration = KOC.StringUtils.ToInt(req.params.F_IsTaskLiveDuration, -1);
                reqParm.IsSalaryBase = KOC.StringUtils.ToInt(req.params.F_IsSalaryBase, -1);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Group = req.params.F_Group;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Family_ID":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "User_ID":
                    case "Score":
                    case "Rating":
                    case "Family_ID":
                    case "Salary":
                    case "Beans_Anchor":
                    case "Beans_Family":
                    case "Beans_Platform":
                    case "Income":
                    case "Cost":
                    case "Profit":
                    case "Gift_Num":
                    case "Gift_Coin":
                    case "Guardian_Count":
                    case "Guardian_Coin":
                    case "Horn_Count":
                    case "Horn_Coin":
                    case "Live_Duration_Efftive":
                    case "Live_Day_Efftive":
                    case "PV_ChannelStrategy":
                    case "User_SignUp_Count":
                    case "User_SignUp_Rate_ChannelStrategy":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "IsProtect":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `IsProtectDue` DESC, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Task_Rate_Beans":
                        reqModel.Sort_Col = "((CASE `Task_Target_Beans` WHEN 0 THEN 0 ELSE 1 END) + `" + reqModel.Sort_Col + "`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Task_Rate_LiveDuration":
                        reqModel.Sort_Col = "((CASE `Task_Target_LiveDuration` WHEN 0 THEN 0 ELSE 1 END) + `" + reqModel.Sort_Col + "`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Task_Rate_LiveDay":
                        reqModel.Sort_Col = "((CASE `Task_Target_LiveDay` WHEN 0 THEN 0 ELSE 1 END) + `" + reqModel.Sort_Col + "`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Coin":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Live_Duration` DESC";
                        break;
                    case "Live_Duration":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC";
                        break;
                    case "Gift_Coin_Return":
                        reqModel.Sort_Col = "(`Gift_Pond_Coin` + `Gift_Lucky_Coin`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Coin":
                        reqModel.Sort_Col = "`Lottery_Coin` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Return":
                        reqModel.Sort_Col = "`Lottery_Winning_Amt` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Profit":
                        reqModel.Sort_Col = "(`Lottery_Coin` - `Lottery_Winning_Amt`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    default:
                        switch (reqParm.Group) {
                            case "Month":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "User":
                                reqModel.Sort_Col = "`Coin` :DIR:, `Live_Duration` DESC";
                                break;
                            case "Month-User":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Family":
                                reqModel.Sort_Col = "`Coin` :DIR:, `Live_Duration` DESC";
                                break;
                            case "Family-Rating":
                                reqModel.Sort_Col = "`Family_ID` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Rating":
                                reqModel.Sort_Col = "`Rating` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Month-Family-Rating":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Family_ID` DESC, `Rating` DESC, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Month-Family":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Month-Rating":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Rating` DESC, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            default:
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                        }
                        break;
                }
                DALFactory.Report.Page.AnchorFamilyMonth(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            FamilyMonth: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Report}[Family](Month-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Report.Page.FamilyMonth_Parm();
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_FamilyID);
                reqParm.Family_Name = req.params.F_FamilyName;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Group = req.params.F_Group;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Family_ID":
                        case "Family_Name":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Family_ID":
                    case "Salary":
                    case "Anchor_Count_Live":
                    case "Anchor_Salary":
                    case "Beans_Anchor":
                    case "Beans_Family":
                    case "Beans_Platform":
                    case "Income":
                    case "Cost":
                    case "Profit":
                    case "Gift_Num":
                    case "Gift_Coin":
                    case "Guardian_Count":
                    case "Guardian_Coin":
                    case "Horn_Count":
                    case "Horn_Coin":
                    case "Live_Duration_Efftive":
                    case "Live_Day_Efftive":
                    case "PV_ChannelStrategy":
                    case "User_SignUp_Count":
                    case "User_SignUp_Rate_ChannelStrategy":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Coin":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Live_Duration` DESC";
                        break;
                    case "Live_Duration":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC";
                        break;
                    case "Gift_Coin_Return":
                        reqModel.Sort_Col = "(`Gift_Pond_Coin` + `Gift_Lucky_Coin`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Coin":
                        reqModel.Sort_Col = "`Lottery_Coin` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Return":
                        reqModel.Sort_Col = "`Lottery_Winning_Amt` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    case "Game_Profit":
                        reqModel.Sort_Col = "(`Lottery_Coin` - `Lottery_Winning_Amt`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                        break;
                    default:
                        switch (reqParm.Group) {
                            case "Month":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                            case "Family":
                                reqModel.Sort_Col = "`Coin` :DIR:, `Live_Duration` DESC";
                                break;
                            default:
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `Coin` DESC, `Live_Duration` DESC";
                                break;
                        }
                        break;
                }
                DALFactory.Report.Page.FamilyMonth(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            ChannelDay: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Report}[Channel](Day-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Report.Page.ChannelDay_Parm();
                reqParm.Channel_ID = KOC.StringUtils.ToIntPositive(req.params.F_ChannelID);
                reqParm.Effective = KOC.StringUtils.ToInt(req.params.F_Effective);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                reqParm.Group = req.params.F_Group;
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Channel_ID":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    // case "Family_ID":
                    // case "Salary":
                    // case "Anchor_Count_Live":
                    // case "Anchor_Salary":
                    // case "Beans_Anchor":
                    // case "Beans_Family":
                    // case "Beans_Platform":
                    // case "Income":
                    // case "Cost":
                    // case "Profit":
                    // case "Gift_Num":
                    // case "Gift_Coin":
                    // case "Guardian_Count":
                    // case "Guardian_Coin":
                    // case "Horn_Count":
                    // case "Horn_Coin":
                    // case "Lottery_Coin":
                    // case "Live_Duration_Efftive":
                    // case "Live_Day_Efftive":
                    // case "PV_ChannelStrategy":
                    // case "User_SignUp_Count":
                    // case "User_SignUp_Rate_ChannelStrategy":
                    //     reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                    //     break;
                    // case "Coin":
                    //     reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Live_Duration` DESC";
                    //     break;
                    // case "Live_Duration":
                    //     reqModel.Sort_Col = "`" + reqModel.Sort_Col + "` :DIR:, `Report_Day` DESC, `Coin` DESC";
                    //     break;
                    // case "Gift_Coin_Return":
                    //     reqModel.Sort_Col = "(`Gift_Pond_Coin` + `Gift_Lucky_Coin`) :DIR:, `Report_Day` DESC, `Coin` DESC, `Live_Duration` DESC";
                    //     break;
                    default:
                        switch (reqParm.Group) {
                            case "Day":
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `UV` DESC";
                                break;
                            case "Channel":
                                reqModel.Sort_Col = "`Channel_ID` :DIR:, `UV` DESC";
                                break;
                            default:
                                reqModel.Sort_Col = "`Report_Day` :DIR:, `UV` DESC";
                                break;
                        }
                        break;
                }
                DALFactory.Report.Page.ChannelDay(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            }
        }
        //endregion
    },
    Log: {
        //region Page:分页
        Page: {
            UserLogin: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Base}[Log](Login-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Log.Page.UserLogin_Parm();
                reqParm.Log_ID = KOC.StringUtils.ToIntPositive(req.params.F_LogID);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Channel_ID = req.params.F_ChannelID;
                reqParm.Inviter_ID = KOC.StringUtils.ToIntPositive(req.params.F_InviterID);
                reqParm.SignUp_Anchor_ID = KOC.StringUtils.ToIntPositive(req.params.F_SignUpAnchorID);
                reqParm.SignUp_Anchor_Family_ID = KOC.StringUtils.ToIntPositive(req.params.F_SignUpAnchorFamilyID);
                reqParm.SignUp_Origin = KOC.StringUtils.ToString(req.params.F_SignUpOrigin);
                reqParm.SignIn_Origin = KOC.StringUtils.ToString(req.params.F_SignInOrigin);
                reqParm.SignIn_Type = KOC.StringUtils.ToString(req.params.F_SignInType);
                reqParm.IsChargeFirst = KOC.StringUtils.ToInt(req.params.F_IsChargeFirst, -1);
                reqParm.IsIDCard = KOC.StringUtils.ToInt(req.params.F_IsIDCard, -1);
                reqParm.IsAnchor = KOC.StringUtils.ToInt(req.params.F_IsAnchor, -1);
                reqParm.IsFamily = KOC.StringUtils.ToInt(req.params.F_IsFamily, -1);
                reqParm.IsAdmin = KOC.StringUtils.ToInt(req.params.F_IsAdmin, -1);
                reqParm.DateType = KOC.StringUtils.ToString(req.params.F_DateType);
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Log_ID":
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Channel_ID":
                        case "Inviter_ID":
                        case "SignUp_Anchor_ID":
                        case "SignUp_Anchor_Family_ID":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Log_ID":
                    case "User_ID":
                    case "Channel_ID":
                    case "Inviter_ID":
                    case "SignUp_Anchor_ID":
                    case "SignUp_Anchor_Family_ID":
                    case "IsChargeFirst":
                    case "IsIDCard":
                    case "IsAnchor":
                    case "IsFamily":
                    case "IsAdmin":
                    case "SignUp_Date":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Log_ID`";
                        break;
                }
                DALFactory.Log.Page.UserLogin(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            UserOperation: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Base}[Log](User-Operation-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Log.Page.UserOperation_Parm();
                reqParm.Log_ID = KOC.StringUtils.ToIntPositive(req.params.F_LogID);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Related_ID = req.params.F_RelatedID;
                reqParm.Related_URL = req.params.F_RelatedURL;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Log_ID":
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Related_ID":
                        case "Related_URL":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Log_ID":
                    case "User_ID":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Log_ID`";
                        break;
                }
                DALFactory.Log.Page.UserOperation(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            FamilyOperation: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Base}[Log](Family-Operation-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Log.Page.FamilyOperation_Parm();
                reqParm.Log_ID = KOC.StringUtils.ToIntPositive(req.params.F_LogID);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Family_ID = KOC.StringUtils.ToIntPositive(req.params.Family_ID);
                reqParm.Family_Name = req.params.Family_Name;
                reqParm.Related_ID = req.params.F_RelatedID;
                reqParm.Related_URL = req.params.F_RelatedURL;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Log_ID":
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Family_ID":
                        case "Family_Name":
                        case "Related_ID":
                        case "Related_URL":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Log_ID":
                    case "User_ID":
                    case "Family_ID":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Log_ID`";
                        break;
                }
                DALFactory.Log.Page.FamilyOperation(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            },
            AdminOperation: function (req, res) {
                //region 判断权限
                if (StateData.RightCode.Admin(req, res, "{Base}[Log](Admin-Operation-List)") !== 0) {
                    res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode("没有权限"));
                    return;
                }
                //endregion
                var reqModel = CommonUtils.Common.AjaxPage.Request(req);
                //查询参数
                var reqParm = new DALFactory.Log.Page.AdminOperation_Parm();
                reqParm.Log_ID = KOC.StringUtils.ToIntPositive(req.params.F_LogID);
                reqParm.User_ID = KOC.StringUtils.ToIntPositive(req.params.F_UserID);
                reqParm.NickName = req.params.F_NickName;
                reqParm.RealName = req.params.F_RealName;
                reqParm.Related_ID = req.params.F_RelatedID;
                reqParm.Related_URL = req.params.F_RelatedURL;
                reqParm.StartDate = KOC.StringUtils.ToString(req.params.F_StartDate);
                reqParm.EndDate = KOC.StringUtils.ToString(req.params.F_EndDate);
                if (reqModel.Filter_Value) {
                    switch (reqModel.Filter_Type) {
                        case "Log_ID":
                        case "User_ID":
                        case "NickName":
                        case "RealName":
                        case "Related_ID":
                        case "Related_URL":
                            reqParm[reqModel.Filter_Type] = reqParm[reqModel.Filter_Type] || reqModel.Filter_Value;
                            break;
                        default:
                            reqParm.FuzzyQuery = reqModel.Filter_Value;
                            break;
                    }
                }
                //排序
                switch (reqModel.Sort_Col) {
                    case "Log_ID":
                    case "User_ID":
                    case "Create_Date":
                        reqModel.Sort_Col = "`" + reqModel.Sort_Col + "`";
                        break;
                    default:
                        reqModel.Sort_Col = "`Log_ID`";
                        break;
                }
                DALFactory.Log.Page.AdminOperation(reqParm, reqModel, function (retValue) {
                    if (retValue.hasError) {
                        res.jsonp(CommonUtils.Common.AjaxPage.ErrorCode(retValue.message + "(" + retValue.errorCode + ")", reqModel.Echo));
                        return;
                    }
                    var PageData = CommonUtils.Common.AjaxPage.PageData(reqModel, retValue);
                    PageData.aaData = retValue.returnObject;
                    res.jsonp(PageData);
                });
            }
        }
        //endregion
    }
};